package com.example.a828502.ormlite.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * Created by 828502 on 2016/5/10.
 */
@DatabaseTable(tableName = "test_ormlite")

public class TestBean implements Parcelable{
    @DatabaseField
    private int id;
    @DatabaseField(columnName = "test_id")
    public String test_id;
    @DatabaseField(columnName = "test_name")
    public String test_name;
    public TestBean(){

    }

    public TestBean(String sId,String sName){

        this.test_id = sId;
        this.test_name = sName;

    }
    protected TestBean(Parcel in) {
        this.id = (Integer) in.readValue(Integer.class.getClassLoader());
        this.test_id = in.readString();
        this.test_name = in.readString();
    }
    public static final Parcelable.Creator<TestBean> CREATOR = new Parcelable.Creator<TestBean>() {
        @Override
        public TestBean createFromParcel(Parcel in) {
            return new TestBean(in);
        }

        @Override
        public TestBean[] newArray(int size) {
            return new TestBean[size];
        }

    };
    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(this.id);
        dest.writeString(this.test_id);
        dest.writeString(this.test_name);

    }


    @Override
    public String toString() {
        return "TestBean{" +
                "id=" + id +
                ", test_id='" + test_id + '\'' +
                ", test_name='" + test_name + '\'' +
                '}';
    }
}
